function handleFullScreen() {
    var de = document.documentElement;
    if (de.requestFullscreen) {
        de.requestFullscreen();
    } else if (de.msRequestFullscreen) {
        de.msRequestFullscreen();
    } else if (de.webkitRequestFullScreen) {
        de.webkitRequestFullScreen();
    } else if (de.mozRequestFullScreen) {
        de.mozRequestFullScreen();
    } else {
        wtx.info("当前浏览器不支持全屏！");
    }
}

function exitFullscreen() {
    var de = document;
    if (de.exitFullscreen) {
        de.exitFullscreen();
    } else if (de.msExitFullscreen) {
        de.msExitFullscreen();
    } else if (de.mozCancelFullScreen) {
        de.mozCancelFullScreen();
    } else if (de.webkitExitFullscreen) {
        de.webkitExitFullscreen();
    }
}

$(function () {
    let body = $("body");
    let main = $(".main")
    let fullScreenButton = $("button.fullScreen");
    let exitFullScreenButton = $("button.exitFullScreen");
    body.on("click", "button.fullScreen", function () {
        handleFullScreen();
    })

    body.on("click", "button.exitFullScreen", function () {
        exitFullscreen();
    })

    $(document).on("fullscreenchange", function (event) {
        if (document.fullscreenElement || document.webkitFullscreenElement) {
            fullScreenButton.css('display', 'none');
            exitFullScreenButton.css("display", "inline-block");
            main.text("我现在是全屏状态");
        } else {
            fullScreenButton.css('display', 'inline-block');
            exitFullScreenButton.css("display", "none");
            main.text("我现在非全屏状态");
        }
    })
})